package org.jeecg.modules.config;

import org.jeecg.common.modules.im.ImService;
import org.jeecg.common.util.tencent.ImUtil;
import org.jeecg.common.util.tencent.SignUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author guoyh
 * @ClassName CententIMConfiguration
 * @Description  腾讯IM配置
 * @since 2020/8/22 21:28
 **/
@Configuration
public class CententIMConfiguration1 {

    @Resource
    private CustomProperties customProperties;

    @Bean
    public SignUtil signUtil(){
        String secret = customProperties.getIm().getSecret();
        Long appid = customProperties.getIm().getAppid();
        return new SignUtil(appid,secret);
    }

    @Bean
    public ImUtil imUtil(){
        CustomProperties.IM im = customProperties.getIm();
        return new ImUtil(im.getVer(),im.getAppid(),im.getAdmin());
    }

    @Bean
    public ImService imService(){
        return new ImService(imUtil());
    }
}
